<?php

namespace App\Http\Requests\Store;

use App\Http\Requests\BaseRequest;
use Illuminate\Foundation\Http\FormRequest;

class AddRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'         => 'required|min:1|max:30',
            'logo'         => 'required',
            'legal_person' => 'required|min:2|max:30',
            'license'      => 'required',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '请填写名称',
            'name.min' => '名称不能少于1个字符',
            'name.max' => '名称不能超过30个字符',
            'logo.required' => '请上传logo',
            'legal_person.required' => '请填写法人',
            'legal_person.min' => '法人不能少于2个字符',
            'legal_person.max' => '法人不能超过30个字符',
            'license.required' => '请上传营业执照',
        ];
    }
}
